﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _11._01.TracingFactorial
{
    class Program
    {
        private static long Factorial(int i)
        {
            if (i < 1)
                return 1;

            var factorial = i * Factorial(i - 1);

            Console.WriteLine("i = {0}; result = {1}", i, factorial);
            return factorial;
        }

        static void Main(string[] args)
        {
            Console.WriteLine("Please enter a number to calculate factorial:");

            int N = int.Parse(Console.ReadLine());

            long result = Factorial(N);

            Console.WriteLine(result);
        }
    }
}
